This example will demonstrate using GeoPandas to load and plot some polygons representing the New York City boroughs. Then we'll put it into a Leaflet map right in the notebook using mplleaflet.


In [1]:
%matplotlib inline
import os

import geopandas as gpd
import matplotlib.pyplot as plt

import mplleaflet

In [2]:
filename = os.path.join('data', 'nybb.zip')
df = gpd.read_file('/nybb.shp', vfs='zip://' + filename)

In [3]:
ax = df.plot()



In [4]:
# The display call inserts the html in the IPython notebook.
# An interactive, panable, zoomable map.
mplleaflet.display(fig=ax.figure, crs=df.crs)


Out[4]:

In [ ]: